package com.geyue.core.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by Lyon on 2017/6/2.
 */
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    @Value("${file.upload.path}")
    private String path;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/file/**").addResourceLocations("file:///"+path);
        super.addResourceHandlers(registry);
    }

}